<ion-view cache-view="false" hide-back-button="true" title="购物车">
  <!-- <ion-nav-buttons side="left">
    <button class="button button-clear" ng-click="back()">
      <i class="icon ion-chevron-left"></i>
    </button>
  </ion-nav-buttons> -->
  <ion-nav-buttons side="right">
    <button class="button button-clear" ng-click="setEdit()">
      <span ng-show="!edit">编辑</span>
      <span ng-show="edit">取消</span>
    </button>
  </ion-nav-buttons>
  <ion-content class="cart">
    <div class="divider"></div>
    <ul class="list" ng-repeat="class1 in cartproducts" ng-show="class1.products && class1.products.length > 0 ">
      <li class="item">
        <div style="float: left">
          {{class1.class_name}}
        </div>
        <div ng-if="class1.sendtype == 0" style="float: right"><img alt="" src="img/hd/ico_39.png" style="height: 15px; margin-top: 5px"/></div>
        <div ng-if="class1.sendtype == 1" style="float: right"><img alt="" src="img/hd/ico_49.png" style="height: 15px; margin-top: 5px"/></div>
        <div ng-if="class1.sendtype == 2" style="float: right"><img alt="" src="img/hd/ico_59.png" style="height: 15px; margin-top: 5px"/></div>
        <div ng-if="class1.sendtype == 3" style="float: right"><img alt="" src="img/hd/ico_cr.png" style="height: 15px; margin-top: 5px"/></div>
      </li>
      <li class="item no-padding goods" ng-repeat="goods in class1.products">
        <div class="row">
          <div class="col col-10 goods-checkbox-area" ng-show="!edit" ng-click="setGoods(goods)">
            <i class="icon ion-ios-circle-outline" ng-show="!goods.isCheck"></i>
            <i class="icon ion-checkmark-circled" ng-show="goods.isCheck" style="color: #d20b19"></i>
          </div>
          <div class="col col-25">
            <img ng-if="!goods.smimgurl" src="img/hd/pic_dd.png" style="width: 100%"/>
            <img ng-if="goods.smimgurl" ng-src="{{goods.smimgurl}}" style="width: 100%"/>
          </div>
          <div class="col col-40" style="padding-left: 10px;">
            <div class="goods-name">
              {{goods.name}}
              <!-- <span class="onsale">打折</span> -->
            </div>
            <div class="counter" ng-hide="edit">
              <p ng-if="goods.product_discount_id > 0" style="font-size: 12px">限购{{goods.xg_amount}}件</p>
              <div class="button-bar">
                <span class="button" ng-click="setNum(goods, -1); $event.stopPropagation()">-</span>
                <div class="count" style="width: 40px">{{goods.num}}</div>
                <span class="button" ng-click="setNum(goods, 1); $event.stopPropagation()">+</span>
              </div>
            </div>
          </div>
          <div class="col" ng-hide="edit" style="text-align: center">
            <div class="goods-cost" style="text-align: center">
              <span style="font-size: 0.8em">{{ ((goods.cx_price || goods.kj_price) * goods.num).toFixed(1)}}</span>
              <span style="font-size: 12px">元</span>
            </div>
          </div>
          <button class="button col main-background" ng-click="deleteGoods(goods); $event.stopPropagation()" ng-show="edit" style="width: 100%; text-align: center; margin-left: 10px; ">
            删除
          </button>
        </div>

      </li>
    </ul>
    <!-- <ul class="list">
      <li class="item">
        失效商品
      </li>
      <li class="item no-padding goods goods-reverse">
        <div class="row">
          <div class="col-10 goods-checkbox-area">
            <img alt="" src="img/hd/pic_sx.png" style="width: 100%">
          </div>
          <div class="col-25">
            <img src="img/hd/pic_dd.png" style="width: 100%"/>
          </div>
          <div class="col-40" style="padding-left: 10px;">
            <div class="goods-name">
              星巴克咖啡
            </div>
            <div style="font-size: 14px; padding-top:23px;">
              宝贝已经不能购买
            </div>
          </div>
        </div>
      </li>
    </ul> -->

    <ul ng-if="activity && cartproducts && cartproducts.length > 0">
      <li class="item piece message">
        <span class="main-color">{{activity.content}}</span>
      </li>
    </ul>

    <div style="height: 60px"></div>
  </ion-content>
  <div style="background-color: #fff; position: fixed; bottom: 45px;width: 100%">
    <div class="row no-padding">
      <div class="col col-30" style="z-index: 1; padding: 0px">
        <div class="list">
        <li class="item item-checkbox item-text-wrap select-all" style="font-size: 13px">
          <label class="checkbox">
            <input ng-model="checkAll" type="checkbox">
          </label>
          全选
        </li>
      </div>
    </div>
    <div class="col col-40" style="text-align: right; padding-top: 5px; margin-left: -18px; margin-right: -5px; z-index: 10">
      <div>
        <span style="line-height: 21px">商品总价
          <span class="main-color ng-binding">{{calculateAmount()}}元</span>
        </span>
      </div>
      <div>
        <span style="line-height: 21px">运费
          <span class="main-color">{{getsendpirce()}}元</span>
        </span>
      </div>
    </div>
    <div class="col piece-btn" ng-click="toPay()" style="margin-left: 10px">
      结算
    </div>
  </div>
</div>
</ion-view>
